package com.hippy.erya.exception;

import lombok.Data;

@Data
public class BaseException extends RuntimeException {

    private static final long serialVersionUID = -4481318310950725753L;
    /**
     * 错误码
     */
    private ErrorCode errorCode;

    /**
     * 额外补充的信息
     */
    private String extraMsg;

    /**
     * 构造
     *
     * @param errorCode 错误码
     * @param extraMsg  错误信息
     */
    public BaseException(ErrorCode errorCode, String extraMsg) {
        super();
        this.errorCode = errorCode;
        this.extraMsg = extraMsg;
    }

    /**
     * 构造
     *
     * @param errorCode 错误码
     */
    public BaseException(ErrorCode errorCode) {
        super();
        this.errorCode = errorCode;
        this.extraMsg = errorCode.getDesc();
    }
}